package pack0831;

public class DemoB {
    public static void main(String[] args) {
        DemoB1 db1 = new DemoB1(1);
        DemoB2 db2 = new DemoB2(2);

        db1.start();
        db2.start();
    }
}

class DemoB1 extends Thread{
    private Integer id;

    public DemoB1(Integer id) {
        this.id = id;
    }

    @Override
    public void run() {
        for (int i = 1; i<11; i++){
            System.out.println("我是线程"+id+"的第"+i+"次执行");
        }
    }
}
class DemoB2 extends Thread{
    private Integer id;

    public DemoB2(Integer id) {
        this.id = id;
    }

    @Override
    public void run() {
        for (int i = 1; i<11; i++){
            System.out.println("我是线程"+id+"的第"+i+"次执行");
        }
    }
}